package top.laoshuzi.mvp;

import android.os.Bundle;
import android.util.Log;

import com.alibaba.android.arouter.facade.annotation.Autowired;

import top.laoshuzi.android.mvp.facade.annotation.BindPresenter;
import top.laoshuzi.mvp.api.home.HomePresenter;
import top.laoshuzi.mvp.api.home.HomeView;
import top.laoshuzi.mvp.api.main.MainPresenter;
import top.laoshuzi.mvp.api.main.MainView;
import top.laoshuzi.mvp.base.BaseActivity;

public class MainActivity extends BaseActivity implements MainView, HomeView {

    @Autowired(name = "/main/MainPresenter")
    @BindPresenter
    MainPresenter mainPresenter;

    @Autowired(name = "/home/HomePresenter")
    @BindPresenter
    HomePresenter homePresenter;

    @Override
    public Object injectObject() {
        return this;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        mainPresenter.welcome();
        homePresenter.hello();
    }

    @Override
    public void onShowWelcome() {
        Log.w("MainActivity", "Welcome");
    }

    @Override
    public void onShowHello() {
        Log.w("MainActivity", "Hello");
    }
}
